import 'package:flutter/material.dart';

//  内容区布局
class ContentLayout extends StatelessWidget {
  final Widget headerSlot;

  final Widget leftSlot;

  final Widget rightSlot;

  const ContentLayout(
      {super.key,
      required this.headerSlot,
      required this.leftSlot,
      required this.rightSlot});

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.all(layoutGap),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.stretch,
        children: [headerRender(),const SizedBox(height: layoutGap), Expanded(child: content())],
      ),
    );
  }

  Widget headerRender() {
    return headerSlot;
  }

  Widget content() {
    return Row(
      crossAxisAlignment: CrossAxisAlignment.stretch,
      children: [
        SizedBox(
          width: leftWidth,
          child: leftSlot,
        ),
        // leftSlot
        const SizedBox(width: layoutGap),
        Expanded(
          child: Container(
            decoration: const BoxDecoration(
              color: Colors.white,
            ),
            child: rightSlot,
          ),
        )
      ],
    );
  }
}

const layoutGap = 12.0;
const leftWidth = 250.0;